import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '工号',
    align: 'center',
    dataIndex: 'code',
  },
  {
    title: '电话',
    align: 'center',
    dataIndex: 'mobile',
  },
  {
    title: '用户名',
    align: 'center',
    dataIndex: 'userName',
  },
  {
    title: '姓名',
    align: 'center',
    dataIndex: 'lastName',
  },
  {
    title: '卡号',
    align: 'center',
    dataIndex: 'cardCode',
  },
  {
    title: '状态',
    align: 'center',
    dataIndex: 'status_dictText',
  },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: '工号',
    field: 'code',
    component: 'JInput',
  },
  {
    label: '电话',
    field: 'mobile',
    component: 'JInput',
  },
  {
    label: '用户名',
    field: 'userName',
    component: 'JInput',
  },
  {
    label: '姓名',
    field: 'lastName',
    component: 'JInput',
  },
  {
    label: '状态',
    field: 'status',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'user_status',
    },
  },
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '工号',
    field: 'code',
    component: 'Input',
    required: true,
  },
  {
    label: '电话',
    field: 'mobile',
    component: 'Input',
  },
  {
    label: '用户名',
    field: 'userName',
    component: 'Input',
    required: true,
  },
  {
    label: '姓名',
    field: 'lastName',
    component: 'Input',
    required: true,
  },
  {
    label: '卡号',
    field: 'cardCode',
    component: 'Input',
    required: true,
  },
  {
    label: '登录密码',
    field: 'loginPassword',
    component: 'Input',
    required: true,
  },
  {
    label: '状态',
    field: 'status',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'user_status',
    },
    required: true,
  },
  // TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];

// 高级查询数据
export const superQuerySchema = {
  code: { title: '工号', order: 1, view: 'number', type: 'number' },
  userName: { title: '用户名', order: 2, view: 'text', type: 'string' },
  lastName: { title: '姓名', order: 3, view: 'text', type: 'string' },
  loginPassword: { title: '登录密码', order: 4, view: 'text', type: 'string' },
  cardCode: { title: '卡号', order: 5, view: 'text', type: 'string' },
  status: { title: '状态', order: 6, view: 'text', type: 'string' },
};

/**
 * 流程表单调用这个方法获取formSchema
 * @param param
 */
export function getBpmFormSchema(_formData): FormSchema[] {
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
